package com.lyq.mr.homework.planThree;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;


//map 输出 key 为 数字 ；
// 对key 进行排序（默认为升序）
// 输出为 排序号 + 数字
public class NumSortingReduce extends Reducer<LongWritable, NullWritable,NullWritable, Text> {


    int i =1;
    Text text = new Text();
    @Override
    protected void reduce(LongWritable key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        for (NullWritable value : values) {
            text.set(i+"\t"+key);
            context.write(NullWritable.get(),text);
            i++;
        }
    }


}
